"use strict";

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

!function (y) {
  "use strict";
  if (void 0 === y) throw new Error("Geetest requires browser environment");var h = y.document,
      b = y.Math,
      v = h.getElementsByTagName("head")[0],
      x = 1e4;function r(t) {
    this._obj = t;
  }r.prototype = { _each: function _each(t) {
      var e,
          o = this._obj;for (e in o) {
        o.hasOwnProperty(e) && t(e, o[e]);
      }return this;
    }, _extend: function _extend(t) {
      var o = this;new r(t)._each(function (t, e) {
        o._obj[t] = e;
      });
    } };function o(t) {
    var o = this;new r(t)._each(function (t, e) {
      o[t] = e;
    });
  }o.prototype = { apiServers: ["gcaptcha4.geetest.com", "gcaptcha4.geevisit.com"], staticServers: ["static.geetest.com", "static.geevisit.com", "dn-staticdown.qbox.me"], protocol: "http://", typePath: "/load", fallback_config: { bypass: { staticServers: ["static.geetest.com", "static.geevisit.com", "dn-staticdown.qbox.me"], type: "bypass", bypass: "/v4/bypass.js" } }, _get_fallback_config: function _get_fallback_config() {
      var t = this;return n(t.type) ? t.fallback_config[t.type] : t.fallback_config.bypass;
    }, _extend: function _extend(t) {
      var o = this;new r(t)._each(function (t, e) {
        o[t] = e;
      });
    } };var n = function n(t) {
    return "string" == typeof t;
  },
      a = /Mobi/i.test(navigator.userAgent),
      i = {},
      s = {},
      c = Object.prototype.toString;function l(t, e) {
    if (t !== Object(t) || "[object Date]" == c.call(t) || "[object RegExp]" == c.call(t) || "[object Boolean]" == c.call(t) || "function" == typeof t) return e ? t.replace(/(\S)(_([a-zA-Z]))/g, function (t, e, o, n) {
      return e + n.toUpperCase() || "";
    }) : t;if ("[object Array]" == c.call(t)) for (var o = [], n = 0; n < t.length; n++) {
      o.push(l(t[n]));
    } else {
      var r,
          o = {};for (r in t) {
        t.hasOwnProperty(r) && (o[l(r, !0)] = l(t[r]));
      }
    }return o;
  }function u(i, s, l, u, f, p, d) {
    function g(e) {
      d && (o = "geetest_" + (parseInt(1e4 * b.random()) + new Date().valueOf()), y[o] = function (e, o) {
        var n;if ("function" == typeof e) return n = Array.prototype.slice.call(arguments, 2), Function.prototype.bind ? e.bind(o, n) : function () {
          var t = Array.prototype.slice.call(arguments);return e.apply(o, n.concat(t));
        };
      }(d, null, o), f.callback = o);var o,
          t,
          n,
          r,
          a,
          c = function (t, e, o, n) {
        e = m(e);o = w(o) + _(n);return o = e ? t + e + o : o;
      }(s, l[e], u, f);c = c, t = function t(_t) {
        if (_t) {
          if (o) try {
            y[o] = function () {
              y[o] = null;
            };
          } catch (t) {}e >= l.length - 1 ? p(!0) : g(e + 1);
        } else p(!1);
      }, n = i.timeout, (r = h.createElement("script")).charset = "UTF-8", r.async = !0, /static\.geetest\.com/g.test(c) && (r.crossOrigin = "anonymous"), a = !(r.onerror = function () {
        t(!0), a = !0;
      }), r.onload = r.onreadystatechange = function () {
        a || r.readyState && "loaded" !== r.readyState && "complete" !== r.readyState || (a = !0, setTimeout(function () {
          t(!1);
        }, 0));
      }, r.src = c, v.appendChild(r), setTimeout(function () {
        a || (r.onerror = r.onload = null, r.remove && r.remove(), t(!0));
      }, n || x);
    }g(0);
  }function f(t, e, o, n) {
    u(o, o.protocol, t, e, { captcha_id: o.captchaId, challenge: o.challenge || "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (t) {
        var e = 16 * b.random() | 0;return ("x" === t ? e : 3 & e | 8).toString(16);
      }), client_type: a ? "h5" : "web", risk_type: o.riskType, call_type: o.callType, lang: o.language || ("Netscape" === navigator.appName ? navigator.language : navigator.userLanguage).toLowerCase() }, function (t) {
      t && "function" == typeof o.offlineCb ? o.offlineCb() : t && n(o._get_fallback_config());
    }, function (t, e) {
      "success" == e.status ? n(e.data) : (e.status, n(e)), y[t] = void 0;try {
        delete y[t];
      } catch (t) {}
    });
  }function p(t, e, o) {
    if ("function" != typeof e.onError) throw new Error({ networkError: "网络错误", gtTypeError: "gt字段不是字符串类型" }[t]);e.onError({ desc: o.desc, msg: o.msg, code: o.code });
  }var m = function m(t) {
    return t.replace(/^https?:\/\/|\/$/g, "");
  },
      w = function w(t) {
    return t = 0 !== (t = t.replace(/\/+/g, "/")).indexOf("/") ? "/" + t : t;
  },
      _ = function _(t) {
    if (!t) return "";var o = "?";return new r(t)._each(function (t, e) {
      !n(e) && "number" != typeof e && "boolean" != typeof e || (o = o + encodeURIComponent(t) + "=" + encodeURIComponent(e) + "&");
    }), (o = "?" === o ? "" : o).replace(/&$/, "");
  };(y.Geetest || h.getElementById("gt_lib")) && (s.slide = "loaded"), y.initGeetest4 = function (t, n) {
    var e,
        c = new o(t);t.https ? c.protocol = "https://" : t.protocol || (c.protocol = y.location.protocol + "//"), "object" == _typeof(e = t.getType) && null !== e && c._extend(t.getType), f(c.apiServers, c.typePath, c, function (t) {
      if ("error" === (t = l(t)).status) return p("networkError", c, t);function e() {
        c._extend(t), n(new y.Geetest4(c));
      }var a = t.type,
          o = (c.debug && new r(t)._extend(c.debug), i[a] = i[a] || [], s[a] || "init");"init" === o ? (s[a] = "loading", i[a].push(e), t.gctPath && u(c, c.protocol, !Object.hasOwnProperty.call(c, "staticServers") && t.staticServers || c.staticServers, t.gctPath, null, function (t) {
        t && p("networkError", c, { code: "60205", msg: "Network failure", desc: { detail: "gct resource load timeout" } });
      }), u(c, c.protocol, !Object.hasOwnProperty.call(c, "staticServers") && t.staticServers || c.staticServers, t.bypass || t.staticPath + t.js, null, function (t) {
        if (t) s[a] = "fail", p("networkError", c, { code: "60204", msg: "Network failure", desc: { detail: "js resource load timeout" } });else {
          s[a] = "loaded";for (var e = i[a], o = 0, n = e.length; o < n; o += 1) {
            var r = e[o];"function" == typeof r && r();
          }i[a] = [];
        }
      })) : "loaded" === o ? e() : "fail" === o ? p("networkError", c, { code: "60204", msg: "Network failure", desc: { detail: "js resource load timeout" } }) : "loading" === o && i[a].push(e);
    });
  };
}(window);var captchaBigData = function captchaBigData(n) {
  var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
  return new Promise(function (e) {
    var t = [{ product: r ? "float" : "bind", captchaId: "54088bb07d2df3c46b79f80300b0abbe", language: "zho", riskType: "slide" }, { product: r ? "float" : "bind", captchaId: "6370a348ba8bddd565b19cb9aea370de", language: "zho" }],
        o = Math.floor(2 * Math.random() + 0);initGeetest4(t[o], function (t) {
      r ? t.appendTo(n) : t.onReady(function () {}), e(t);
    });
  });
};